﻿Public Partial Class Formulario_web14
    Inherits System.Web.UI.Page
    Dim ocnTrabajoFinal As New CapaNegocio.TrabajoFinal()
    Dim ocnNotas As New CapaNegocio.Notas


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        cargargrilla(Me.TextBoxNroExpediente.Text)
    End Sub

    Function cargargrilla(ByVal nroExpediente As String)
        Dim ds As New DataSet

        ds = ocnNotas.obtenerNotas(nroExpediente)

        Me.GridViewNotas.DataSource = ds.Tables(0)

        Me.GridViewNotas.DataBind()
        Return Me.GridViewNotas
    End Function


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Try
            ocnNotas.InsertarNroResolucionAN(Me.TextBoxNroResolucionAN.Text _
                                                    , Me.TextBoxNroExpediente.Text _
                                                    , CDate(Me.TextBoxFecha.Text))
            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
        Try
            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub
End Class